package p270jp.pxv.android.activity;

import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.BackStackRecord;
import com.google.android.gms.common.Scopes;
import java.io.Serializable;
import java.util.Objects;
import p014ae.AbstractActivityC0058c4;
import p018ai.PixivSettings;
import p047bg.C1124a;
import p064c6.Preconditions;
import p134ei.AnalyticsScreenName;
import p134ei.PixivAnalytics;
import p165fo.Subscribe;
import p189gn.AbstractC3435a;
import p216hn.Lambda;
import p216hn.Reflection;
import p270jp.pxv.android.R;
import p270jp.pxv.android.commonObjects.model.WorkType;
import p270jp.pxv.android.event.SelectWorkTypeEvent;
import p270jp.pxv.android.model.PixivProfile;
import p314lg.ActivityUserWorkBinding;
import p325m0.MutabilityOwnership;
import p547uh.UserWorkFragment;
import p579vo.Qualifier;
import p603wm.AbstractC6949c;

/* compiled from: UserWorkActivity.kt */
/* renamed from: jp.pxv.android.activity.UserWorkActivity */
/* loaded from: classes2.dex */
public final class UserWorkActivity extends AbstractActivityC0058c4 {

    /* renamed from: b0 */
    public WorkType f18722b0;

    /* renamed from: c0 */
    public final AbstractC6949c f18723c0 = Preconditions.m9802P(1, new C4139a(this, null, null));

    /* compiled from: ComponentCallbackExt.kt */
    /* renamed from: jp.pxv.android.activity.UserWorkActivity$a */
    /* loaded from: classes2.dex */
    public static final class C4139a extends Lambda implements AbstractC3435a<PixivSettings> {

        /* renamed from: a */
        public final /* synthetic */ ComponentCallbacks f18724a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4139a(ComponentCallbacks componentCallbacks, Qualifier aVar, AbstractC3435a aVar2) {
            super(0);
            this.f18724a = componentCallbacks;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [ai.b, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final PixivSettings invoke() {
            return C1124a.m10173s(this.f18724a).f24118a.m920a().m621a(Reflection.m5499a(PixivSettings.class), null, null);
        }
    }

    /* renamed from: e1 */
    public static final Intent m4686e1(Context context, long j, PixivProfile pixivProfile, WorkType workType) {
        MutabilityOwnership.m3745m(context, "context");
        MutabilityOwnership.m3745m(pixivProfile, Scopes.PROFILE);
        MutabilityOwnership.m3745m(workType, "workType");
        Intent intent = new Intent(context, UserWorkActivity.class);
        intent.putExtra("USER_ID", j);
        intent.putExtra("USER_INFO", pixivProfile);
        intent.putExtra("WORK_TYPE", workType);
        return intent;
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        WorkType workType;
        super.onCreate(bundle);
        C1124a.m10197Q(this, ((ActivityUserWorkBinding) DataBindingUtil.m11369d(this, R.layout.activity_user_work)).f21387s, R.string.user_works);
        PixivAnalytics eVar = this.f18757A;
        MutabilityOwnership.m3746l(eVar, "pixivAnalytics");
        eVar.m6524f(AnalyticsScreenName.USER_WORK, null);
        long longExtra = getIntent().getLongExtra("USER_ID", 0);
        Serializable serializableExtra = getIntent().getSerializableExtra("USER_INFO");
        Objects.requireNonNull(serializableExtra, "null cannot be cast to non-null type jp.pxv.android.model.PixivProfile");
        PixivProfile pixivProfile = (PixivProfile) serializableExtra;
        if (bundle != null) {
            Serializable serializable = bundle.getSerializable("WORK_TYPE");
            Objects.requireNonNull(serializable, "null cannot be cast to non-null type jp.pxv.android.commonObjects.model.WorkType");
            workType = (WorkType) serializable;
        } else {
            Serializable serializableExtra2 = getIntent().getSerializableExtra("WORK_TYPE");
            Objects.requireNonNull(serializableExtra2, "null cannot be cast to non-null type jp.pxv.android.commonObjects.model.WorkType");
            workType = (WorkType) serializableExtra2;
        }
        this.f18722b0 = workType;
        PixivSettings bVar = (PixivSettings) this.f18723c0.getValue();
        WorkType workType2 = this.f18722b0;
        if (workType2 != null) {
            bVar.m12121g(workType2);
            BackStackRecord cVar = new BackStackRecord(m11131K0());
            WorkType workType3 = this.f18722b0;
            if (workType3 != null) {
                cVar.m11165j(R.id.user_work_list_container, UserWorkFragment.m1700B(longExtra, pixivProfile, workType3));
                cVar.mo11171d();
                return;
            }
            MutabilityOwnership.m3737u("workType");
            throw null;
        }
        MutabilityOwnership.m3737u("workType");
        throw null;
    }

    @Subscribe
    public final void onEvent(SelectWorkTypeEvent selectWorkTypeEvent) {
        MutabilityOwnership.m3745m(selectWorkTypeEvent, "event");
        WorkType workType = selectWorkTypeEvent.getWorkType();
        MutabilityOwnership.m3746l(workType, "event.workType");
        this.f18722b0 = workType;
    }

    @Override // androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onSaveInstanceState(Bundle bundle) {
        MutabilityOwnership.m3745m(bundle, "outState");
        WorkType workType = this.f18722b0;
        if (workType != null) {
            bundle.putSerializable("WORK_TYPE", workType);
            super.onSaveInstanceState(bundle);
            return;
        }
        MutabilityOwnership.m3737u("workType");
        throw null;
    }
}
